package com.gitee.wsl.common.ui.theme


import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.text.TextStyle

//定义一些常用的 style
object Style {
    fun <P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>> SampleStyle(inTheme: THEME): SampleStyle<P, T, THEME> = object :
        SampleStyle<P, T, THEME> {
        override val theme: THEME
            get() = inTheme

        override val color: Int
            get() = theme.colorSchemeAndroid.primary
        override val textStyle: TextStyle
            get() = theme.typography.button
    }
}

interface BaseStyle<P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>>{
    val theme:THEME
}


interface SampleStyle<P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>>: BaseStyle<P, T, THEME> {
    val backgroundColor: Int
        get() = Color.Transparent.toArgb()

    val color:Int get() = theme.colorSchemeAndroid.primary

    val textStyle: TextStyle
}

interface ButtonStyle{}

val Style.Button: ButtonStyle
    get() = object: ButtonStyle {}

fun <P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>> ButtonStyle.defaultStyle(inTheme: THEME): SampleButtonStyle<P, T, THEME> = SampleButtonStyleImp(inTheme)

fun <P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>> ButtonStyle.defaultOverrideStyle(inTheme: THEME): SampleButtonStyle<P, T, THEME> = SampleButtonStyleImp(inTheme)


interface SampleButtonStyle<P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>>:
    BaseStyle<P, T, THEME> {
    val backgroundColor: Int
        get() = Color.Transparent.toArgb()

    val color:Int
        get() = theme.colorSchemeAndroid.primary

    val textStyle: TextStyle
        get() = theme.typography.button

    val baseStyle: SampleStyle<P, T, THEME>
        get() = Style.SampleStyle(theme)
}

open class SampleButtonStyleImp<P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>>(override val theme: THEME):
    SampleButtonStyle<P, T, THEME> {

}

open class SampleOverrideButtonStyleImp<P: ColorPaletteScheme,T: TypographyScheme,THEME:Theme<P, T>>(theme: THEME):
    SampleButtonStyleImp<P, T, THEME>(theme){
    override val color: Int
        get() = theme.colorSchemeAndroid.secondary
}


